package com.niit.syy.unit_priceByhousefacing;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;

public class Unit_priceByHousefacingMapper extends Mapper<LongWritable, Text,Text,LongWritable> {
    private Text outk = new Text();
    private LongWritable outv = new LongWritable();

    @Override
    protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
        String lineData = value.toString();
        String[] datas = lineData.split(",");
        if (datas.length >= 15) {
            outk.set(datas[8]);
            outv.set(Long.parseLong(datas[15]));
            context.write(outk, outv);
        }
    }
}
